home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok33.lha
/
Wirth
/
Kurven
/
LineDrawing.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
3KB
|
91 lines
(* -------------------------------------------------------------------------
:Program. LineDrawing
:Author. Kai Bolay
:Address. Hoffmannstraße 168, 7250 Leonberg
:Phone. 07152/22135
:History. v1.00 Initial
:Copyright. PD
:Language. Modula-2
:Translator. M2Amiga 3.2d
:Imports. Turtle [Manfred Weigl], IntuiStruct [bne]
:Contents. Module supposed by Wirth
------------------------------------------------------------------------- *)
IMPLEMENTATION MODULE LineDrawing;
(* FOLD: IMPORT *)
FROM SYSTEM IMPORT ADR;
FROM Arts IMPORT TermProcedure, Assert;
FROM Intuition IMPORT ScreenPtr, NewScreen, OpenScreen, CloseScreen,
WindowPtr, NewWindow, OpenWindow, CloseWindow,
WindowFlags, WindowFlagSet, customScreen,
IDCMPFlags, IDCMPFlagSet;
FROM Graphics IMPORT ViewModes, ViewModeSet, SetRGB4;
FROM IntuiStruct IMPORT StructScreen, StructWindow;
FROM Turtle IMPORT InitTurtleWin, Forward, MoveTo, SetHeading;
(* ENDFD *)
(* FOLD: CloseDown *)
PROCEDURE CloseDown;
BEGIN
IF LineDrawWindow # NIL THEN
CloseWindow (LineDrawWindow);
LineDrawWindow := NIL;
END; (* IF *)
IF LineDrawScreen # NIL THEN
CloseScreen (LineDrawScreen);
LineDrawScreen := NIL;
END; (* IF *)
END CloseDown;
(* ENDFD *)
(* FOLD: OpenUp *)
PROCEDURE OpenUp;
VAR NewLineDrawScreen : NewScreen;
NewLineDrawWindow : NewWindow;
BEGIN
LineDrawWindow := NIL;
LineDrawScreen := NIL;
TermProcedure (CloseDown);
StructScreen (NewLineDrawScreen, 2, 0, 1, ViewModeSet {}, customScreen,
ADR ("LineDraw! Have Fun with Wirth..."));
LineDrawScreen := OpenScreen (NewLineDrawScreen);
Assert (LineDrawScreen # NIL, ADR ("Can't open Screen!"));
WITH LineDrawScreen^ DO
SetRGB4 (ADR (viewPort), 0, 0, 0, 0);
SetRGB4 (ADR (viewPort), 1, 15, 15, 15);
SetRGB4 (ADR (viewPort), 2, 15, 0, 0);
SetRGB4 (ADR (viewPort), 3, 0, 15, 0);
END; (* WITH *)
StructWindow (NewLineDrawWindow, 0, 11, LineDrawScreen^.width,
LineDrawScreen^.height - 11, 0, 1, IDCMPFlagSet {},
WindowFlagSet {backDrop, activate, rmbTrap, borderless},
NIL, LineDrawScreen, customScreen);
LineDrawWindow := OpenWindow (NewLineDrawWindow);
Assert (LineDrawWindow # NIL, ADR ("Can't open Window!"));
InitTurtleWin (LineDrawWindow);
END OpenUp;
(* ENDFD *)
(* FOLD: Line *)
PROCEDURE Line (dir45 : INTEGER; dist : INTEGER);
BEGIN
SetHeading ((dir45 + 2) * 45);
Forward (dist);
END Line;
(* ENDFD *)
(* FOLD: SetXY *)
PROCEDURE SetXY (x, y : INTEGER);
BEGIN
MoveTo (x, y);
END SetXY;
(* ENDFD *)
BEGIN
OpenUp;
width := LineDrawWindow^.width;
height := LineDrawWindow^.height;
END LineDrawing.